/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package services.Impl;

import javax.ejb.LocalBean;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import models.Questions;
import services.interfaces.IQuestionService;

/**
 *
 * @author milokokok
 */

@Stateless
@LocalBean

public class QuestionsServiceImpl extends GenericServiceImpl<Questions> implements IQuestionService {

    @PersistenceContext(unitName="orsPU")
    private EntityManager em;
    
    
    public QuestionsServiceImpl() {
        super(Questions.class);
    }
    
    
    @Override
    protected EntityManager getEntityManager() {
        return this.em;
   
    }

    @Override
    public Questions getQuestionsById(Long id) {
       Query q1 = em.createNamedQuery("Questions.findById").setParameter("id", id);
       Questions q = (Questions)q1.getSingleResult();
        return q;
    }
    
}
